
#include "Bishop.h"

Bishop::Bishop(bool white) : Piece(white) {
}

Bishop::~Bishop() {
}

std::string Bishop::GetType() const{
   return "bishop";
}

std::set<BoardPosition> Bishop::GetAllMoves(Board * b, BoardPosition curPos) {
   std::set<BoardPosition> ReturnSet;

   for (int i=-7; i <8; i++) {
      //Bishop moves
      BoardPosition pos(curPos.GetRow()+i, curPos.GetCol()+i);
      if (pos.IsOnBoard())
         ReturnSet.insert(pos);
      pos = BoardPosition(curPos.GetRow()+i, curPos.GetCol()-i);
      if (pos.IsOnBoard())
         ReturnSet.insert(pos);
   }

   return ReturnSet;
}

std::set<BoardPosition> Bishop::GetLegalMoves(Board * b, BoardPosition curPos) {
   std::set<BoardPosition> ReturnSet;

   for (int i=-7; i <8; i++) {
      //Bishop moves
      BoardPosition pos(curPos.GetRow()+i, curPos.GetCol()+i);
      if (pos.IsOnBoard())
         ReturnSet.insert(pos);
      pos = BoardPosition(curPos.GetRow()+i, curPos.GetCol()-i);
      if (pos.IsOnBoard())
         ReturnSet.insert(pos);
   }

   return ReturnSet;
}
